// $Id: ApplicationWorkbenchAdvisor.java 87 2012-02-29 22:49:36Z huijzer@gmail.com $
package lime;

import lime.application.preference.GeneralPreferencePage;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.application.IWorkbenchConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchAdvisor;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {

	IPreferenceStore store;
	
	@Override
	public void initialize(IWorkbenchConfigurer configurer) {
		super.initialize(configurer);
		store = Activator.getDefault().getPreferenceStore();
		configurer.setSaveAndRestore(store.getBoolean(GeneralPreferencePage.APPLICATION_SAVE_STATE));
	}
	
	public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		return new ApplicationWorkbenchWindowAdvisor(configurer);
	}

	public String getInitialWindowPerspectiveId() {
		return store.getString(GeneralPreferencePage.APPLICATION_DEFAULT_PERSPECTIVE);
	}
}
